<!Doctype html>
<html>
<head>
	<meta charset="utf-8" />
	<title></title>
	<style>
		#box{
            margin: 10px;
            width: 200px;
            border: 1px solid blue;
        }
        #box2{
            margin: 10px;
            width: 200px;
            border: 1px solid blue;
        }
	</style>
</head>
<body>
	<div id="box">Hired.com发布特朗普上任后的“全球科技企业招聘状况”数据报告</div>
	<div id="box2">Hired.com发布特朗普上任后的“全球科技企业招聘状况”数据报告</div>
	<script>
		var str = document.getElementById('box').innerHTML;
		var str2 = document.getElementById('box2').innerHTML;
		console.log(str);
		console.log(str2);
		function showStr(string,length,extraString){
			if (extraString) {
				return string.slice(0,length) + extraString;
			} else {
				return string.slice(0,length);
			}
		}
		document.getElementById('box').innerHTML = showStr(str,16);
		document.getElementById('box2').innerHTML = showStr(str2,15,'...');
		console.log(str);
		console.log(str2);
		var s = document.getElementById('box').innerHTML;
		var s2 = document.getElementById('box2').innerHTML;
		console.log(s);
		console.log(s2);
	</script>
</body>
</html>